import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Fuhao } from './fuhao';
import { FuhaoService } from './fuhao.service'
@Component({
  selector: 'my-top4',
  templateUrl: 'app/top4.component.html',
  styleUrls: ['app/top4.component.css']
})
export class Top4Component implements OnInit {
  fuhaos: Fuhao[] = [];
  constructor(
    private router: Router,
    private fuhaoService: FuhaoService
  ) { }
  ngOnInit() {
    this.fuhaoService.getFuhaos()
      .then(fuhaos => this.fuhaos = fuhaos.slice(0, 4));
  }
    gotoDetail(fuhao: Fuhao) {
      let link = ['/detail', fuhao.id];
      this.router.navigate(link);
  }

  
}
